﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RookieGrow.Domain.Model.SportsStore;

namespace RookieGrow.Domain.SportsStore
{
    public class DiscountValueCalculator : IValueCalculator
    {
        private IDiscounter discounter;

        public DiscountValueCalculator(IDiscounter discounter) 
        {
            this.discounter = discounter;
        }
        public decimal ValueProducts(List<Product> products)
        {
            return discounter.ApplyDiscount(products.Sum(p => p.Price));
        }
    }
}
